package com.iuie.ns.devtools.element;

import java.util.List;
import java.util.Map;

import com.iuie.ns.devtools.to.DevBodyTO;

public class JavaBeanGetMethodDevElement extends DevElement {
	
	private DevBodyTO body;

	private Map<String, String> fieldTypeRelationMap;
	
	public JavaBeanGetMethodDevElement(DevBodyTO body, Map<String, String> fieldTypeRelationMap) {
		this.body = body;
		this.fieldTypeRelationMap = fieldTypeRelationMap;
	}

	@Override
	protected String getPrefix() {
		String javaType = fieldTypeRelationMap.get(body.getFieldType());
		return "\tpublic " + javaType + " " + body.getGetMethodName() + "() {\n";
	}

	@Override
	protected String getSuffix() {
		StringBuilder sb = new StringBuilder(12);
		sb.append("\t\treturn this.")
			.append(body.getAttributeName())
			.append(";\n\t}\n");
		return sb.toString();
	}

	@Override
	protected List<DevElement> getChildren() {
		return null;
	}

}
